<?php
/* 
 * project_name
 * Created on 17.01.2005
 *
 * @version $Id: newsletter.inc.php,v 1.2 2005/08/01 10:16:40 phppc Exp $
 * @copyright 2005 
 */

$this->uf_field[1] = 'name';
	$this->uf_input[1]['ml'] = 50;
	$this->uf_input[1]['size'] = 20;
$this->uf_field[2] = 'descr';
	$this->uf_input[2]['type'] = 'textarea';
	$this->uf_input[2]['rows'] = 4;
	$this->uf_input[2]['cols'] = 50;
$this->uf_field[3] = 'kat_id';
	$this->uf_input[3]['type'] = 'kat';
	$this->uf_input[3]['first_lang'] = 'news_show_all_cats';
$this->uf_field[4] = 'active';
	$this->uf_input[4]['type'] = 'input_name';
	$this->uf_input[4]['start'] = 0;
	$this->uf_input[4]['ende'] = 1;	

$newsletter = $this->fun_sg2var('newsletter');
$newsletter = $this->uf_form_conf_def($newsletter,array('show','new','edit','do_edit','del'));
$this->module_new_value["action"] = "newsletter";

if($newsletter == "show") {
	$erg = $this->db_abfrage_q("SELECT * FROM ".$this->config["prefix"]."newsletter");
	$tpl_newsletter_loop = "";
	while ($db_newsletter = $this->db_abfrage_fetch($erg)) {
		$this->tpl_load('newsletter_one','admin/');
		$link_edit = $this->fun_make_link('admin.php','newsletter=edit&newsletter_id='.$db_newsletter['id']);
		$this->module_new_value['action'] = "newsletter_members";
		$link_members = $this->fun_make_link('admin.php','newsletter_id='.$db_newsletter['id']);
		$this->module_new_value["action"] = "newsletter";
		$this->tpl_replace_vars(array('name' => $db_newsletter['name'],'cat' => $this->db_kat[$db_newsletter['kat_id']]['name'],'active' => $db_newsletter['active'],'link_edit' => $link_edit,"link_members" => $link_members));
		$tpl_newsletter_loop .= $this->tpl_output();
	}
	$hidden_array["newsletter"] = "new";
	$var_array["active"] = 1;
	$tpl_newsletter_new = $this->uf_create_complete_form('admin_newsletter_new_title',$hidden_array,'admin_newsletter_new_submit','form_reset',"complete_form","uf/","admin.php",$var_array,"admin_newsletter_");
	$this->tpl_load('newsletter','admin/');
	$this->tpl_replace_vars(array('tpl_newsletter_loop' => $tpl_newsletter_loop,'tpl_newsletter_new' => $tpl_newsletter_new));
	$nc_main = $this->tpl_output();
}elseif($newsletter == "new") {
	list($return,$abfrage1,$abfrage2) = $this->uf_create_array_conf("insert");
	if($this->uf_form_conf($return) == 1) {
		if($this->db_abfrage_q('INSERT '.$this->config['prefix'].'newsletter ('.$abfrage1.') VALUES ('.$abfrage2.')')) {
			$this->message_green[] = 26;
			$this->w_leitung['number'] = 13;
			$this->w_leitung['url'] = $this->fun_make_link("admin.php");
		}
	}
}

?>
